package cn.example.game.module.player;

import cn.example.game.db.bean.Player;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.artifact.core.lang.IServer;

import java.util.HashMap;
import java.util.Map;

@Accessors(chain = true)
@Setter
@Getter
public class PlayerVO extends Player {

    private Map mailStatus = new HashMap();

    /**
     * 写数据之前
     */
    protected void onWrite() {
        this.setServerMailStatus(IServer.me().getContext().getJsonFactory().getJson().toJson(mailStatus));
    }

    /**
     * 读数据之后
     */
    protected void onRead() {
        mailStatus = IServer.me().getContext().getJsonFactory().getJson().parse(this.getServerMailStatus(), HashMap.class);
    }
}
